package com.base.cn.platform.os.controller.manage.log;

import com.base.cn.platform.os.common.controller.BaseController;
import com.base.cn.platform.os.common.mybatis.Pagination;
import com.base.cn.platform.os.entity.manage.log.OpLogEntity;
import com.base.cn.platform.os.service.manage.log.OpLogBiz;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 文 件 名:OpLogController
 * 创 建 人:hackeridear
 * 创建日期:2018-12-05
 * 描   述:OpLogController
 * 修 改 人:
 * 修改日期:
 * 版 本 号:v 1.0.0
 */
@RestController
@RequestMapping("/manage/log")
public class OpLogController extends BaseController {

    @Autowired
    private OpLogBiz opLogBiz;

    /**
     * 保存操作日志
     * @param opLogEntity
     */
    @RequestMapping("/saveOpLog")
    public void findUserRoleListByUserId(@RequestBody OpLogEntity opLogEntity){
        opLogBiz.save(opLogEntity);
    }


    /**
     * 分页查询操作日志
     * @param condition
     * @param currentPage
     * @param pageSize
     * @return
     */
    @RequestMapping("/findOpLogListPage")
    public PageInfo<OpLogEntity> findOpLogListPage(@RequestBody OpLogEntity condition, @RequestParam(value = "currentPage",required = false,defaultValue = "1") int currentPage,
                                                @RequestParam(value = "pageSize",required = false,defaultValue = "10") int pageSize){
        Pagination page = new Pagination();
        page.setCurrentPage(currentPage);
        page.setPageSize(pageSize);
        return opLogBiz.findOpLogListPage(condition,page);
    }



}
